{% extends 'base.html' %}

{% block title %}博客系统首页{% endblock title %}


{% block content %}
    <h1>博客列表</h1> 
    <p>博客数量: {{ posts | length }}</p>

    {% for message in get_flashed_messages() %}
    <div class="alert alert-info alert-dismissible fade show" role="alert">
        <strong>状态:</strong> {{ message }}
        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
        <span aria-hidden="true">&times;</span>
        </button>
    </div>
    {% endfor %}

    <!-- 显示博客title -->
    {% for post in posts %}
        <a href="{{ url_for('get_post', post_id=post.id) }}"><h2>{{ post.title }}</h2></a>
        <span class="badge badge-primary">{{ post.timestamp }}</span>
        <a href="{{url_for('edit_post', post_id=post.id)}}"><span class="badge badge-primary">编辑</span></a>
        <hr>
    {% endfor %}
{% endblock content %}
